/*--------------------------------------------------------------------------------------*\
**
** adv_ferry.cpp
**
** Heroes IV
** Copyright 2000, The 3DO Company
**
\*--------------------------------------------------------------------------------------*/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "adventure_object_global_id.h"

#include "abstract_adv_object.h"
#include "sized_int_types.h"


t_adventure_global_id read_adventure_global_id( std::streambuf &buffer )
{
	t_adventure_global_id id;
	
	id = get<t_uint32>( buffer );

	return id;
}

void write_adventure_global_id( std::streambuf &buffer, t_adventure_global_id id )
{
	put<t_uint32>( buffer, id );
}


t_adventure_global_id_factory::t_adventure_global_id_factory()
{
	m_id_counter = k_first_valid_adventure_global_id;
}
	
t_adventure_global_id	t_adventure_global_id_factory::get_new_id( ) 
{
	return m_id_counter++;
}

t_adventure_global_id	t_adventure_global_id_factory::get_id_counter() 
{
	return m_id_counter;
}

void  t_adventure_global_id_factory::set_id_counter( t_adventure_global_id const & new_id )
{
	m_id_counter = new_id;
}

void t_adventure_global_id_factory::read( std::streambuf &buffer )
{
	m_id_counter = get<t_uint32>( buffer );
}

void t_adventure_global_id_factory::write( std::streambuf &buffer )
{
	put<t_uint32>( buffer, m_id_counter );
}
